package com.mills.gamebase.model;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 * Dieses Model repr�sentiert einen Benutzer in der gamebase
 * 
 * @author Shane
 *
 */
@Entity
public class User extends AbstractModel {
	
	private String email;
	/**
	 * Der Benutzername des Users
	 */
	private String username;
	/**
	 * Das Passwort des Users
	 */
	private String password;
	/**
	 * Die Rollen des Users
	 */
	private List<Role> roles;
	
	public void setPassword(String password) {
		this.password = password;
	}
	public String getPassword() {
		return password;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getUsername() {
		return username;
	}
	public void setRoles(List<Role> roles) {
		this.roles = roles;
	}
	@ManyToMany
	@JoinTable( name = "user_role", 
			joinColumns = {	@JoinColumn( name = "user_id" )}, 
			inverseJoinColumns = { @JoinColumn( name = "role_id" )} )
	public List<Role> getRoles() {
		return roles;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getEmail() {
		return email;
	}
}
